package company.XW;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class XW2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Long> result = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int apples = sc.nextInt();
            int[] array = new int[apples];
            for (int j = 0; j < apples; j++) {
                array[i] = sc.nextInt();
            }
            Arrays.sort(array);
            Long min = Long.MAX_VALUE;
            for (int j = 1; j < apples; j++) {
                if (min == 0)
                    break;
                min = Math.min(min, array[j] - array[j - 1]);
            }
            result.add(min);
        }
        for (Long l : result) {
            System.out.println(l);
        }
    }
}
